package com.qing.common.base;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewbinding.ViewBinding;

public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActivity {

    protected final String TAG = this.getClass().getSimpleName();

    private VB mViewBinding;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mViewBinding = createViewBinding();
        setContentView(mViewBinding.getRoot());

        initView();
        initData(savedInstanceState);
        initListener();
    }

    protected abstract VB createViewBinding();

    protected abstract void initView();

    protected abstract void initData(@Nullable Bundle savedInstanceState);

    protected abstract void initListener();

    protected VB getBinding() {
        return mViewBinding;
    }
}
